package com.springboot.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AdminMapper {
	//返回id，找不到时null（也是登录）
	@Select("select adminId where adminName = #{adminName} and password = #{password}")
	public Integer getAdminByIdByPass(String adminName , String password);
	//管理员不可以添加！！！（默认数据库那几个）
	
	//返回影响行数
	@Delete("delete from admin where adminName = #{adminName} and password =#{password}")
	public int deleteAdmin(String adminName , String password);
	
	//更改密码需要先输入旧密码，再验证新密码两次
	@Update("update admin set newPass = #{newPass} where adminName = #{adminName}")
	public int updateAdminOfPass(String adminName , String newPass);
	
	//更改用户名
	@Update("update admin set adminName = #{adminName} where adminId = #{adminId}")
	public int updateAdminOfName(String adminName , Integer adminId);
}
